#include<iostream>
int main()
{
	int x, y ,t;//x,y细胞初始数目，t为时间
	std::cin >> x >> y >> t;
	for (int i = 1; i <= t*2; i++)//the key 
	{
		if (i % 2 == 1)
			y -= x;
		if (x % 4 == 0)
			x *= 2;
		if (y % 6 == 0)
			y *= 2;
	}//very important
	std::cout << y << std::endl;
	return 0;
}